<?php 
class getListCandidateAction extends AdminMaster{
	public function execute($request){
		switch ($this->data['action']) {
			case 'get':
				$export_id = $request->getParameter('export_id', '-1');
				$tmp = CandidateToExportsTable::getListByExportId($export_id);
				$arr = array('-1');
				foreach($tmp as $a){
					$arr[] = $a['candidate_id'];
				}
				$this->data['list'] = CandidatesTable::getDataList(array('filter_ids_in' => $arr), null,null);
				$this->setVar('data', $this->data);
				return sfView::SUCCESS;
				break;
			case 'remove':
				$export_id = $request->getParameter('export_id', '-1');
				$candidate_id = $request->getParameter('candidate_id', -1);
				if(CandidateToExportsTable::deleteByCandidateIdExportId($candidate_id, $export_id)){
					echo '1';
				}else{
					echo __('export-remove-fail', null, 'export_exports');
				}
				break;
		}
		return sfView::NONE;
	}
}